package by.bsu.fpmi.bbtp.controllers;


import by.bsu.fpmi.bbtp.authentication.Role;
import by.bsu.fpmi.bbtp.authentication.AllowedRoles;
import by.bsu.fpmi.bbtp.entities.Client;
import by.bsu.fpmi.bbtp.entities.Order;
import by.bsu.fpmi.bbtp.entities.OrderHead;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import java.util.List;

@WebService
@SOAPBinding(style= SOAPBinding.Style.RPC)
@AllowedRoles({Role.SALESMAN, Role.TRANSPORT_MANAGER})
public interface OrderController {

    @WebMethod
    public void cancelOrder(@WebParam(name = "sessionId") String sessionId,
                            @WebParam(name = "orderId") long orderId);

    @WebMethod
    public void saveOrder(@WebParam(name = "sessionId") String sessionId,
                          @WebParam(name = "order") Order order);

    @WebMethod
    public void createOrder(@WebParam(name = "sessionId") String sessionId,
                            @WebParam(name = "order") Order order,
                            @WebParam(name = "client") Client client);

    @WebMethod
    public void createOrderForReturn(@WebParam(name = "sessionId") String sessionId,
                                     @WebParam(name = "orderId") long orderId);

    @WebMethod
    public List<OrderHead> getAllOrders(@WebParam(name = "sessionId") String sessionId);

    @WebMethod
    public List<OrderHead> getOrdersForReturn(@WebParam(name = "sessionId") String sessionId);

    @WebMethod
    public List<OrderHead> getReadyOrders(@WebParam(name = "sessionId") String sessionId);

    @WebMethod
    public List<OrderHead> getSentOrders(@WebParam(name = "sessionId") String sessionId);

    @WebMethod
    public Order getOrder(@WebParam(name = "sessionId") String sessionId,
                          @WebParam(name = "orderId") long orderId);

    @WebMethod
    public void setTransportCompanyForOrder(@WebParam(name = "sessionId") String sessionId,
                                            @WebParam(name = "orderId") long orderId,
                                            @WebParam(name = "transportCompanyId") long transportCompanyId);
}
